import request from "@/utils/request";
enum Api {
    exameList = "/exam/exame/list",
    goExame = "/exam/exame/goExame/",
    exameAnswer = "/exam/exame/answer",
    dict = "/system/dict/data/type/",
}
// 根据字典类型查询字典数据信息
export function getDicts(dictType: string) {
    return request({
        url: Api.dict + dictType,
        method: 'get'
    })
}
// 获取历年真题列表
export function exameList(query: Object) {
    const queryInfo = {
        ...query,
        exameType: 1,
        examPublishStatus: 2,
    }
//     paperSubject: '0',//   paperType: '0',//   isExame: 3,
    if ((queryInfo as any).paperSubject === '0') {
        delete (queryInfo as any).paperSubject
    }
    if ((queryInfo as any).paperType === '0') {
        delete (queryInfo as any).paperType
    }
    if ((queryInfo as any).isExame === 3) {
        delete (queryInfo as any).isExame
    }
    return request({
        url: Api.exameList,
        method: "get",
        params: queryInfo,
    });
}

// 进入考试获取考试信息
export function goExameInfo(exameId: string) {
    return request({ url: `${Api.goExame}${exameId}`, method: "get" });
}
// 查询试卷管理详细
export function getPaper(paperId: string) {
    return request({
      url: '/examination/paper/show/' + paperId,
      method: 'get'
    })
  }
// 提交考试答案
export function exameAnswer(data: Object) {
    return request({ url: Api.exameAnswer, method: "post", data: data });
}
